package com.talent.web.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.talent.web.model.entity.SysMenu;
import com.talent.web.model.entity.SysUser;
import com.talent.web.model.query.UserQuery;
import com.talent.web.model.vo.SysUserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @ClassName：ResponseEnum
 * @Author: hszhou
 * @Date: 2024/10/21 13:35
 * @Description: 用户mapper
 */
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {


    IPage<SysUserVo> page(IPage<SysUserVo> page, @Param("query") UserQuery query);

    void upgradePassword(@Param("username") String username, @Param("password") String newPassword);

    List<Long> hasRoleIds(@Param("userId") Long userId);

    void removeRoleByUserIdAndRoleIds(@Param("userId")Long userId,@Param("roles") List<String> hasRoleIds);

    void saveUserRole(@Param("roles") List<String> roleIds, @Param("userId") Long userId);

    List<SysMenu> getPermissions(Long userId);


}
